package com.sas.hnn;

import android.util.Log;

public class Person implements Comparable<Person> {

	private String TAG = Person.class.getSimpleName();

	private String name;
	private String street;
	private String locale;
	private int age;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Person(String name, String age, String street, String locale) {
		super();
		this.name = name;
		this.street = street;
		this.locale = locale;
		this.age = Integer.parseInt(age);
	}

	public String getStreet() {
		return street;
	}

	public void setStreet(String street) {
		this.street = street;
	}

	public String getLocale() {
		return locale;
	}

	public void setLocale(String locale) {
		this.locale = locale;
	}

	public int getAge() {
		return age;
	}

	public String getStringAge() {
		return String.valueOf(age);
	}

	public void setAge(int age) {
		this.age = age;
	}

	public int compareTo(Person another) {
		Log.d(TAG, "was" + Persons.sortWhat);
		if (Persons.sortWhat.equals("name"))
			return name.compareTo(another.name);
		if (Persons.sortWhat.equals("street"))
			return street.compareTo(another.street);
		if (Persons.sortWhat.equals("locale"))
			return locale.compareTo(another.locale);
		if (Persons.sortWhat.equals("age"))
			return another.getAge() - age;

		return 0;
	}

}
